package cn.dengta.webapp.user.model;

import java.math.BigDecimal;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.common.model.ValueProxyImpl;
import cn.dengta.common.util.Common;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum GameDiceBetType implements ValueProxyImpl<GameDiceBetType, Integer> {

	ZERO(0, "零", BigDecimal.ONE),
	BIG(1, "大", BigDecimal.valueOf(2)),
	SMALL(2, "小", BigDecimal.valueOf(2)),
	SINGLE(3, "单", BigDecimal.valueOf(2)),
	DOUBLE(4, "双", BigDecimal.valueOf(2)),
	LEOPARD(5, "豹子", BigDecimal.valueOf(20)),

	RED(6, "红", BigDecimal.ONE),
	BLACK(7, "黑", BigDecimal.ONE),
	TWELVE(8, "0-12", BigDecimal.ONE),
	TWENTY_FOUR(9, "13-24", BigDecimal.ONE),
	THIRTY_SIX(10, "25-36", BigDecimal.ONE),

	;
	@EnumValue
	public Integer value;
	public String label;
	public BigDecimal ratio;

	final ValueProxy<GameDiceBetType, Integer> proxy;

	public static final GameDiceBetType[] betType = values();

	/** 骰子 */
	public static final GameDiceBetType[] dicts = new GameDiceBetType[] {
			BIG, SMALL, SINGLE, DOUBLE, LEOPARD
	};
	/** 转盘 */
	public static final GameDiceBetType[] roulette = new GameDiceBetType[] {
			ZERO, SINGLE, DOUBLE, RED, BLACK, TWELVE, TWENTY_FOUR, THIRTY_SIX
	};

	GameDiceBetType(Integer value, String label, BigDecimal ratio) {
		this.value = value;
		this.label = label;
		this.ratio = ratio;
		this.proxy = new ValueProxy<>(this, ordinal(), label);
	}

	public static GameDiceBetType of(Integer value) {
		return Common.getEnum(betType, GameDiceBetType::getValue, value);
	}

}
